﻿using System;
using System.Collections.Generic;
using Hematology.Data;
using Hematology.Tools;
using Hematology.UserSite.Controls;

namespace Hematology.UserSite
{
	public partial class Help : NgoPage
	{
		private void FillFaqList()
		{
			List<FaqItem> lFaqItem = FaqItem.GetFaqItems();
			rptFaqItems.DataSource = lFaqItem;
			rptFaqItems.DataBind();
		}

		protected void Page_Load(object sender, EventArgs e)
		{
			if (Page.IsPostBack)
				return;

			FillFaqList();
		}

		protected void btnSendQuestion_Click(object sender, EventArgs e)
		{
			MailHelper.SendEmailToSupport(txtEmail.Text, cbSendMeSupportEmailCopy.Checked, new[]
			                                                                               	{
			                                                                               		txtUserName.Text.Trim(),
			                                                                               		txtEmail.Text.Trim(),
			                                                                               		txtMessage.Text.Trim(),
			                                                                               		DateTime.Now.ToLongDateString(),
			                                                                               		DateTime.Now.ToLongTimeString()
			                                                                               	});

			Response.Redirect(Request.RawUrl);
		}
	}
}